<template>
  <div class="shop" v-if="shop">
    <div class="store-msg">
      <div class="msg-left">
        <div class="logo">
          <img v-lazy="shop.storeLogoUrl" alt="" />
        </div>
        <div class="msg">
          <h3 class="name">{{ shop.storeName }}</h3>
          <div class="detail">
            <span v-if="shop.isOwnShopValue == '自营店铺'" class="first"
              >自营</span
            >
            <span class="second">关注{{ shop.followNumber }}</span>
            <span class="third">已售{{ shop.orderFinishedCount }}</span>
          </div>
        </div>
      </div>
      <div class="msg-right">
        <span
          @click="
            $router.push({ path: '/store', query: { storeid: shop.storeId } })
          "
          >进店</span
        >
      </div>
    </div>
    <div class="store-goods">
      <ul class="list">
        <li v-for="i in shop?.goodsListVOList?.slice(0, 3)" :key="i.goodsId">
          <img v-lazy="i.goodsImage" alt="" />
          <p>￥{{ i.goodsPrice.toFixed(2) }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Lazyload } from "vant";

Vue.use(Lazyload);
export default {
  props: ["shop"],
};
</script>

<style lang="scss" scoped>
.shop {
  background-color: #fff;
  padding: 10rem;
  border-radius: 10rem;
  box-sizing: border-box;
  margin-bottom: 10rem;
  .store-msg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .msg-left {
      display: flex;
      align-items: center;
      justify-content: left;
      .logo {
        display: flex;
        align-items: center;
        img {
          width: 40px;
          height: 40px;
          border-radius: 50%;
        }
      }
      .msg {
        margin-left: 10rem;

        h3.name {
          font-size: 15rem;
          color: #2d2d2d;
        }
        .detail {
          margin-top: 8rem;
          margin-bottom: 15rem;
          span {
            color: #999;
            &.first {
              background-color: red;
              color: #fff;
              padding: 1rem 3rem;
              border-radius: 8rem;
              margin-right: 8rem;
            }
            &.second {
              margin-right: 8rem;
            }
            &.third {
              padding: 0 8rem;
              border-left: 1px solid #999;
            }
          }
        }
      }
    }
    .msg-right {
      span {
        font-size: 14rem;
        color: #fb1b1b;
        padding: 3rem 10rem;
        border: 1px solid #fb1b1b;
        border-radius: 10rem;
        font-weight: bold;
      }
    }
  }
  .store-goods {
    ul.list {
      display: flex;
      justify-content: space-between;
      li {
        border-radius: 10rem;
        overflow: hidden;
        position: relative;

        img {
          width: 108rem;
          height: 108rem;
          font-size: 0;
          display: block;
        }
        p {
          width: 100%;
          background-color: rgba(0, 0, 0, 0.2);
          position: absolute;
          bottom: 0;
          left: 0;
          text-align: center;
          padding: 4rem 0;
          color: #fff;
          font-weight: bold;
        }
      }
    }
  }
}
</style>